package com.nick.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by xiaobao on 2017/7/6.
 */
public class JDKTranslator implements InvocationHandler {
    private Object target;

    public JDKTranslator(Object target) {
        this.target = target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("JDK Translator start translating...");
        Object object = method.invoke(target, args);
        System.out.println("你好，我是尼克，来自中国。");
        System.out.println("JDK Translator finished translating.");
        return object;
    }
}
